﻿Imports DevExpress.XtraPrinting

Public Class frmTotalizacionDeudaCliente

    Private Sub frmTotalizacionDeudaCliente_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: esta línea de código carga datos en la tabla 'MEGASTOREDataSet.SP_VerClientesCreditosVigentes' Puede moverla o quitarla según sea necesario.
        Me.SP_VerClientesCreditosVigentesTableAdapter.Fill(Me.MEGASTOREDataSet.SP_VerClientesCreditosVigentes)

    End Sub

    Private Sub btnFiltrar_Click(sender As Object, e As EventArgs) Handles btnFiltrar.Click
        Me.SP_TotalizacionDeudaClienteTableAdapter.Fill(Me.MEGASTOREDataSet.SP_TotalizacionDeudaCliente, Me.cboClientes.EditValue)
    End Sub

    Private Sub btnExportarWord_Click(sender As Object, e As EventArgs) Handles btnExportarWord.Click
        If sfdWord.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcTotalizacionDeuda
            link.Landscape = True
            link.CreateDocument()
            link.PrintingSystemBase.ExportToRtf(sfdWord.FileName)
        End If
    End Sub

    Private Sub bnExportaXLS_Click(sender As Object, e As EventArgs) Handles bnExportaXLS.Click
        If sfdExcel.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcTotalizacionDeuda
            link.Landscape = True
            link.CreateDocument()
            link.PrintingSystemBase.ExportToXls(sfdExcel.FileName)
        End If
    End Sub

    Private Sub btnExportaPDF_Click(sender As Object, e As EventArgs) Handles btnExportaPDF.Click
        If sfdPDF.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcTotalizacionDeuda
            link.Landscape = True
            link.CreateDocument()
            link.PrintingSystemBase.ExportToPdf(sfdPDF.FileName)
        End If
    End Sub
End Class